home *** CD-ROM | disk | FTP | other *** search
File List | 1989-07-02 | 17.5 KB | 833 lines |
- '
- ' *********************************************************************
- ' D R A W I T !
- ' A Graphics Design Program
- ' for Young Children
- ' yet another kidprg in GFA Basic from
- ' D.A. Brumleve
- ' Copyright 1989 by ST-LOG
- ' **********************************************************************
- ' Monochrome
- ' Version 1.7
- ' February 16, 1989
- ' **********************************************************************
- ' REFERENCE
- ' **********************************************************************
- ' VARIABLES
- ' Aa%
- ' Alrt$
- ' Ax%
- ' Ay%
- ' Backgrnd%
- ' Bb%
- ' Brush$--string representing brush mouse
- ' Button%
- ' C%
- ' Cbutton%
- ' Cc%--currently-selected color option
- ' Clor_choice$--snapshot of the color choices with none selected
- ' Crayon$--string representing crayon mouse
- ' Current_options$--snapshot of the top row of options with current selections
- ' filled
- ' Dd%
- ' Drw_type%--type of drawing to be performed:
- ' Drw_type%=1...FILL
- ' Drw_type%=2...SMALL DOTS
- ' Drw_type%=3...MEDIUM-SIZED DOTS
- ' Drw_type%=4...LARGE DOTS
- ' Dummy%
- ' Dur%
- ' Filel%
- ' Foregrnd%
- ' Fstyle%--current fill style
- ' Ftype%--current fill pattern type
- ' G%
- ' Gg%
- ' I%
- ' Just_drew%--value (0 or 1) indicates whether the last action was performed
- ' on the easel and if the mouse button is still down
- ' Lx%
- ' Main_screen$--snapshot of the main screen
- ' Mk%
- ' Mx%
- ' My%
- ' N%
- ' Nt%
- ' Oct%
- ' Old_aa%
- ' Old_bb%
- ' Oldcc%
- ' Old_drw_type%
- ' Opt_box$()--snapshot of each of the option boxes without indicator fillings
- ' Palette%()
- ' Pattern$--snapshot of the FILL option with the currently-selected fill pattern
- ' Pg%
- ' Pic$()--array containing the five pictures
- ' Picn$
- ' Rez%
- ' Sg%
- ' Ss%
- ' Stx%
- ' Sty%
- ' Temporary_pic$--snapshot of the picture prior to the current drawing action
- ' Yes%
- '
- '
- ' ***************************** INITIALIZATION *************************
- Dim Palette%(1),Pic$(6),Opt_box$(7)
- @Check_rez
- Gg%=16
- Hidem
- @Save_palette
- Graphmode 2
- @Set_color
- Cls
- @Title
- Cls
- Drw_type%=2
- Cc%=0
- @Make_main_screen
- Sget Main_screen$
- Drw_type%=2
- @Determine_draw_option
- Temporary_pic$=Pic$(1)
- Cc%=0
- Old_cc%=0
- Deffill 1,2,8
- Fill 55,55
- Pg%=1
- Fstyle%=3
- Ftype%=2
- Deffill 1,2,8
- Pbox 116,62,198,90
- Fill 109,1
- Deffill Cc%,Ftype%,Fstyle%
- Pbox 116,62,198,90
- Get 114,60,200,92,Pattern$
- Deftext 1,0,0,13
- Picn$="PIC "+Str$(Pg%)
- Text 442+Gg%+3,28,Picn$
- Put 0,112,Pic$(Pg%)
- @Make_mouse
- @Select_sound
- @Let_go
- Showm
- '
- ' **************************** MAIN PROGRAM **************************
- Do
- Top:
- Repeat
- Mouse Ax%,Ay%,Button%
- If Button%=0
- Just_drew%=0
- Endif
- Until Button%>0
- Get 0,112,638,398,Pic$(Pg%)
- ' *** option boxes
- If Ay%<116 And Just_drew%=1
- Goto Top
- Endif
- If Ay%>0 And Ay%<44
- ' *** PRINT option
- If Ax%>0 And Ax%<98 And Drw_type%<>1
- @Print_it
- Just_drew%=0
- Endif
- ' *** DRAW option
- If Ax%>108 And Ax%<206
- Put 108,0,Opt_box$(2)
- Deffill 1,2,8
- Fill 109,1
- @Select_sound
- Old_drw_type%=Drw_type%
- @Determine_draw_option
- If Old_drw_type%=1
- @Make_mouse
- Put 108,54,Opt_box$(7)
- Pbox 116,62,198,90
- Put 114,60,Pattern$
- Endif
- Just_drew%=0
- Endif
- ' *** UNDO option
- If Ax%>216 And Ax%<314
- Get 0,0,638,52,Current_options$
- Deffill 1,2,8
- Fill 218,1
- @Select_sound
- Pause 15
- Put 0,112,Temporary_pic$
- Put 0,0,Current_options$
- Just_drew%=0
- Endif
- ' *** BLANK option
- If Ax%>324 And Ax%<422
- Get 0,0,638,52,Current_options$
- Get 0,112,638,398,Temporary_pic$
- Deffill 1,2,8
- Fill 326,1
- @Select_sound
- Pause 15
- Pbox 10,120,628,390
- @Erase_sound
- Put 0,0,Current_options$
- Just_drew%=0
- Endif
- ' *** PIC # option
- If Ax%>432 And Ax%<530
- @Select_sound
- Put 432,0,Opt_box$(5)
- Get 0,0,638,52,Current_options$
- Get 0,112,638,398,Pic$(Pg%)
- Deffill 1,2,8
- Fill 434,1
- Inc Pg%
- If Pg%=6
- Pg%=1
- Endif
- Put 0,112,Pic$(Pg%)
- Temporary_pic$=Pic$(Pg%)
- Put 0,0,Current_options$
- Deftext 1,0,0,13
- Picn$="PIC "+Str$(Pg%)
- Text 445+Gg%,28,Picn$
- Just_drew%=0
- Endif
- ' *** EXIT option
- If Ax%>540 And Ax%<638
- Get 0,0,638,52,Current_options$
- Deffill 1,2,8
- Fill 542,1
- @Select_sound
- Just_drew%=0
- @Save_routine
- If Yes%=1
- Hidem
- Deffill 1,2,8
- Pbox 10,120,628,390
- Deftext 0,0,0,32
- Text 262,260,"B Y E !"
- @Finale_sound
- Cls
- @Restore_palette
- Showm
- End
- Else
- Put 0,0,Current_options$
- Put 0,112,Pic$(Pg%)
- Endif
- @Let_go
- Endif
- Endif
- If Ay%>54 And Ay%<98
- ' *** color choices
- If (Ax%>0 And Ax%<44) Or (Ax%>54 And Ax%<98)
- @New_color
- Endif
- ' *** FILL option
- If Ax%>108 And Ax%<206
- Old_drw_type%=Drw_type%
- Deffill 1,2,8
- Fill 109,55
- Put 108,0,Opt_box$(2)
- Drw_type%=1
- @Drw_icon
- If Cc%=1
- Put 0,54,Clor_choice$
- Cc%=0
- Deffill 1,2,8
- Fill 55,55
- Old_cc%=Cc%
- Endif
- If Old_drw_type%=1
- @Change_fill_pattern
- Else
- @Select_sound
- Endif
- If Old_drw_type%<>1
- @Make_mouse
- Endif
- Get 114,60,200,92,Pattern$
- Endif
- @Let_go
- Just_drew%=0
- Endif
- ' *** easel
- If Ax%>12 And Ax%<626 And Ay%>121 And Ay%<388 And Drw_type%=4
- If Just_drew%=0
- Get 0,112,638,398,Temporary_pic$
- Endif
- @Draw_lines
- Just_drew%=1
- Goto Top
- Endif
- If Ax%>11 And Ax%<627 And Ay%>120 And Ay%<390 And Drw_type%=3
- If Just_drew%=0
- Get 0,112,638,398,Temporary_pic$
- Endif
- @Draw_lines
- Just_drew%=1
- Goto Top
- Endif
- If Ax%>9 And Ax%<629 And Ay%>119 And Ay%<391
- If Just_drew%=0
- Get 0,112,638,398,Temporary_pic$
- Endif
- If Drw_type%=1 And Point(Ax%,Ay%)=1
- Deffill Cc%,Ftype%,Fstyle%
- Fill Ax%,Ay%
- Endif
- If Drw_type%=2
- @Draw_lines
- Endif
- Just_drew%=1
- Endif
- Loop
- '
- Procedure Draw_lines
- Deffill Cc%,2,8
- Color Cc%
- If Drw_type%=2
- Draw Ax%,Ay%
- Endif
- If Drw_type%=3
- Defline 1,4,0,0
- Draw Ax%,Ay%-1 To Ax%,Ay%+1
- Endif
- If Drw_type%=4
- Defline 1,6,0,0
- Draw Ax%,Ay%-1 To Ax%,Ay%+3
- Endif
- Old_aa%=Ax%
- Old_bb%=Ay%
- Do
- Mouse Aa%,Bb%,Cbutton%
- Exit If Cbutton%=0
- Exit If (Aa%<11 Or Aa%>627 Or Bb%<121 Or Bb%>389) And Drw_type%=2
- Exit If (Aa%<13 Or Aa%>625 Or Bb%<122 Or Bb%>388) And Drw_type%=3
- Exit If (Aa%<10 Or Aa%>624 Or Bb%<123 Or Bb%>386) And Drw_type%=4
- If Aa%<631 And Aa%>7 And Bb%>119 And Bb%<391 And Drw_type%=2
- Draw Aa%,Bb% To Old_aa%,Old_bb%
- Old_aa%=Aa%
- Old_bb%=Bb%
- Endif
- If Aa%>10 And Aa%<628 And Bb%>120 And Bb%<390 And Drw_type%=3
- Pbox Aa%,Bb%,Aa%+1,Bb%+1
- Defline 1,4,0,0
- Draw Old_aa%,Old_bb% To Aa%,Bb%
- Old_aa%=Aa%
- Old_bb%=Bb%
- Endif
- If Aa%>13 And Aa%<625 And Bb%>121 And Bb%<388 And Drw_type%=4
- Pbox Aa%,Bb%,Aa%+1,Bb%+1
- Defline 1,6,0,0
- Draw Old_aa%,Old_bb% To Aa%,Bb%
- Old_aa%=Aa%
- Old_bb%=Bb%
- Endif
- Loop
- Defline 1,1,0,0
- Showm
- Return
- '
- Procedure Change_fill_pattern
- Deffill 1,2,8
- Fill 108,54
- @Other_sound
- Inc Fstyle%
- If Ftype%=2
- If Fstyle%=11
- Fstyle%=16
- Endif
- If Fstyle%=18
- Fstyle%=19
- Endif
- If Fstyle%=25
- Ftype%=3
- Fstyle%=1
- Else
- Goto Didit
- Endif
- Endif
- If Ftype%=3
- If Fstyle%=13
- Ftype%=2
- Fstyle%=3
- Endif
- Endif
- Didit:
- If Cc%=0
- Deffill 1,2,8
- Else
- Deffill 0,2,8
- Endif
- Pbox 116,62,198,90
- Deffill Cc%,Ftype%,Fstyle%
- Pbox 116,62,198,90
- Return
- '
- Procedure New_color
- If Ax%>0 And Ax%<44 And Cc%=0
- If Drw_type%=1
- Put 108,54,Opt_box$(7)
- Pbox 116,62,198,90
- Put 114,60,Pattern$
- Put 108,0,Opt_box$(2)
- @Determine_draw_option
- Deffill 1,2,8
- Fill 109,1
- @Make_mouse
- Endif
- Put 0,54,Clor_choice$
- Cc%=1
- Deffill 1,2,8
- Fill 1,55
- Endif
- If Ax%>54 And Ax%<98 And Cc%=1
- Put 0,54,Clor_choice$
- Cc%=0
- Deffill 1,2,8
- Fill 55,55
- Endif
- If Old_cc%=Cc%
- Goto No_change
- Endif
- Old_cc%=Cc%
- @Other_sound
- No_change:
- Return
- '
- Procedure Determine_draw_option
- Inc Drw_type%
- If Drw_type%=2
- Goto Gotit
- Endif
- If Drw_type%=5
- Drw_type%=2
- Endif
- Gotit:
- @Drw_icon
- Return
- '
- Procedure Drw_icon
- Dd%=1
- Color Dd%
- If Drw_type%<3
- Defline 1,0,0,0
- Draw 180,22
- Endif
- If Drw_type%=3
- Defline 1,4,0,0
- Draw 178,22 To 182,22
- Endif
- If Drw_type%=4
- Defline 1,6,0,0
- Draw 178,22 To 184,22
- Endif
- Defline 1,0,0,0
- Return
- '
- ' ******************************** DIALOGS *******************************
- Procedure Save_routine
- @Save_alert
- Deftext 0,0,0,32
- Text 84,200,"Do you want to save your work?"
- @Check_target
- If Yes%=1
- Hidem
- @Save_it
- Showm
- Endif
- @Save_alert
- Deftext 0,0,0,32
- Text 104,200,"Do you really want to quit?"
- @Check_target
- Return
- '
- Procedure Save_alert
- Deffill 1,2,8
- Pbox 10,120,628,390
- Deffill 0,2,8
- Pbox 102,242,238,338
- Pbox 400,242,536,338
- Color 0
- Box 96,236,244,344
- Box 394,236,542,344
- Deffill 1,2,8
- Pbox 104,244,236,336
- Deffill 1,2,8
- Pbox 402,244,534,336
- Deftext 0,0,0,32
- Text 140,300,"Yes!"
- Text 450,300,"No."
- Return
- '
- Procedure No_room
- Deffill 1,2,8
- Pbox 10,120,628,390
- Deftext 0,0,0,32
- Text 200,205," There is not"
- Text 200,245,"enough room on"
- Text 200,285," this disk to"
- Text 194,325,"save your work!"
- @Dud_sound
- Pause 150
- Return
- '
- Procedure No_printer
- Sg%=35
- Deffill 1,2,8
- Pbox 10,120,628,390
- Deftext 0,0,0,32
- Text 200-Sg%,205,"Something is wrong!"
- Text 200-Sg%,245,"Is your printer on?"
- Text 200-28,285,"Is it connected to"
- Text 194-Sg%,325," your computer?"
- @Dud_sound
- Pause 150
- Return
- '
- ' ********************************** PRINT ********************************
- Procedure Print_it
- Hidem
- Deffill 1,2,8
- Fill 1,1
- Sget Main_screen$
- @Select_sound
- Pause 15
- If Out?(0)=-1
- Cls
- Deffill 1,2,8
- Pbox 0,0,639,399
- Put 0,50,Pic$(Pg%)
- Hardcopy
- Cls
- Else
- @No_printer
- Endif
- Sput Main_screen$
- Put 0,0,Opt_box$(1)
- Showm
- Return
- '
- ' ***************************** DISK ACTIVITIES ***************************
- Procedure Load_it
- Open "I",#1,"MDRAWIT!.DAT"
- Filel%=Lof(#1)
- If Filel%<>114830
- Close #1
- Kill "mdraw_it!.dat"
- Goto Flmissing
- Endif
- For I%=1 To 5
- Get 0,112,638,398,Pic$(I%)
- Next I%
- For I%=1 To 5
- Bget #1,Varptr(Pic$(I%)),Len(Pic$(I%))
- Put 0,112,Pic$(I%)
- @Select_sound
- Pause 30
- Next I%
- Close #1
- Flmissing:
- Return
- '
- Procedure Save_it
- If Exist("MDRAWIT!.DAT")
- Dd%=1
- Else
- Dd%=0
- If Dfree(0)>114830
- Dd%=1
- Endif
- Endif
- If Dd%=1
- Deffill 1,2,8
- Pbox 10,120,628,390
- Deftext 0,0,0,32
- Text 250,260,"Saving..."
- Open "o",#1,"MDRAWIT!.DAT"
- For I%=1 To 5
- Bput #1,Varptr(Pic$(I%)),Len(Pic$(I%))
- Next I%
- Close #1
- Endif
- If Dd%=0
- @No_room
- Endif
- Return
- '
- ' ********************************* SCREENS *******************************
- Procedure Make_main_screen
- ' *** draw the easel
- Deffill 1,2,8
- Pbox 0,112,638,398
- Deffill 0,2,8
- Pbox 4,116,634,394
- Deffill 1,2,8
- Pbox 10,120,628,390
- ' *** draw the color choices
- Restore Clor_choice_data
- For I%=1 To 2
- Read Lx%,C%
- Color 1
- Box Lx%*2,54,(Lx%+22)*2,98
- Box (Lx%+3)*2,60,(Lx%+19)*2,92
- If C%=1
- Deffill 1,2,8
- Pbox (Lx%+4)*2,62,(Lx%+18)*2,90
- Endif
- Next I%
- Get 0,54,98,98,Clor_choice$
- Box 108,54,206,98
- Box 114,60,200,92
- Get 108,54,206,98,Opt_box$(7)
- ' *** text in option boxes
- Deftext 1,0,0,13
- Text 117+Gg%,28,"DRAW"
- Text 232+Gg%,28,"UNDO"
- Text 332+Gg%,28,"BLANK"
- Text 445+Gg%,28,"PIC"
- Text 557+Gg%,28,"EXIT"
- Text 13+Gg%,28,"PRINT"
- ' *** draw the option boxes
- Lx%=0
- For I%=1 To 6
- Color 1
- Box Lx%*2,0,(Lx%+49)*2,44
- Box (Lx%+3)*2,6,(Lx%+46)*2,38
- Get Lx%*2,0,(Lx%+49)*2,44,Opt_box$(I%)
- Add Lx%,54
- Next I%
- If Not Exist("MDRAWIT!.DAT")
- For I%=1 To 5
- Get 0,112,638,398,Pic$(I%)
- Next I%
- Endif
- Return
- '
- Procedure Title
- G%=125
- Sg%=75
- Deftext 1,1,0,32
- Text 192,40,"D R A W I T !"
- Deftext 1,1,0,13
- Text 70+G%,70," A Graphics Design Program"
- Text 66+G%,90," for Young Children"
- If Exist("MDRAWIT!.DAT")
- @Load_it
- Pause 50
- Endif
- Deffill 0,2,8
- Pbox 0,112,638,398
- Ss%=80
- Deftext 1,1,0,6
- Text 90+Sg%,70+Ss%,"YET ANOTHER KIDPRG IN GFA BASIC FROM"
- Deftext 1,0,0,6
- Text 310,70+Ss%,Chr$(191)
- Deftext 1,0,0,13
- Text 60+G%,90+Ss%," D.A. Brumleve"
- Deftext 1,5,0,6
- Text 109+Sg%,108+Ss%," ST-LOG"
- Deftext 1,1,0,6
- Text 109+Sg%,108+Ss%," COPYRIGHT 1989 BY"
- Deftext 1,1,0,6
- Text 102+Sg%,126+Ss%," MONOCHROME VERSION 1.7"
- Ss%=40
- Deftext 1,1,0,13
- Text 45+G%,230+Ss%,"As published originally in !"
- Sty%=92+Ss%
- Stx%=-12
- Color 1
- Box 408+Stx%,104+Sty%,448+Stx%,146+Sty%
- Color 0
- Box 410+Stx%,106+Sty%,446+Stx%,144+Sty%
- Deffill 0,2,8
- Pbox 410+Stx%,132+Sty%,446+Stx%,144+Sty%
- Deffill 1,2,8
- Pbox 412+Stx%,108+Sty%,444+Stx%,130+Sty%
- Deftext 0,1,0,32
- Text 414+Stx%,130+Sty%," T"
- Text 410+Stx%,130+Sty%,"S"
- Deftext 1,1,0,6
- Text 410+Stx%+11,142+Sty%," G"
- Text 410+Stx%+6,142+Sty%," O"
- Text 411+Stx%,142+Sty%,"L"
- Deffill 1,2,8
- Pbox 0,300,638,398
- Deffill 0,2,8
- Pbox 4,304,634,394
- Deffill 1,2,8
- Pbox 8,308,630,390
- Deftext 0,1,0,13
- Text 75+G%,354,"Press mouse button to begin."
- @Let_go
- Repeat
- Until Mousek
- Return
- '
- ' *************************** WATCH THE MOUSE *************************
- Procedure Let_go
- Repeat
- Mouse Mx%,My%,Mk%
- Until Mk%=0
- Return
- '
- Procedure Check_target
- @Let_go
- Repeat
- Mouse Aa%,Bb%,Cbutton%
- Until Cbutton%>0 And Bb%>240 And Bb%<340 And ((Aa%>398 And Aa%<538) Or (Aa%>100 And Aa%<240))
- Deffill 0,2,8
- If Aa%>398 And Aa%<538
- Yes%=0
- Fill 396,238
- Else
- Yes%=1
- Fill 98,238
- Endif
- @Alert_sound
- Pause 25
- Return
- '
- Procedure Make_mouse
- If Drw_type%=1
- @Make_brush
- Defmouse Brush$
- Else
- @Make_crayon
- Defmouse Crayon$
- Endif
- Return
- '
- Procedure Make_crayon
- Restore Ms_data
- Let Crayon$=Mki$(0)+Mki$(0)
- Let Crayon$=Crayon$+Mki$(0)
- Let Crayon$=Crayon$+Mki$(0)
- Let Crayon$=Crayon$+Mki$(1)
- For I%=1 To 16
- Read Backgrnd%
- Let Crayon$=Crayon$+Mki$(Backgrnd%)
- Next I%
- For I%=1 To 16
- Read Foregrnd%
- Let Crayon$=Crayon$+Mki$(Foregrnd%)
- Next I%
- Return
- '
- Procedure Make_brush
- Restore Brush_data
- Let Brush$=Mki$(0)+Mki$(0)
- Let Brush$=Brush$+Mki$(0)
- Let Brush$=Brush$+Mki$(1)
- Let Brush$=Brush$+Mki$(0)
- For I%=1 To 16
- Read Backgrnd%
- Let Brush$=Brush$+Mki$(Backgrnd%)
- Next I%
- For I%=1 To 16
- Read Foregrnd%
- Let Brush$=Brush$+Mki$(Foregrnd%)
- Next I%
- Return
- '
- ' **************************** COLOR PALETTE **************************
- Procedure Check_rez
- Rez%=Xbios(4)
- If Rez%<>2
- Alrt$=" |This version of DRAW IT!|requires High Resolution."
- Alert 3,Alrt$,1,"Oops!",Dummy%
- End
- Endif
- Return
- '
- Procedure Save_palette
- For I%=0 To 1
- Palette%(I%)=Xbios(7,W:I%,W:-1)
- Next I%
- Return
- '
- Procedure Restore_palette
- For I%=0 To 1
- Setcolor I%,Palette%(I%)
- Next I%
- Return
- '
- Procedure Set_color
- Setcolor 0,0
- Setcolor 1,0
- Return
- '
- ' ******************************* SOUNDS *********************************
- Procedure Select_sound
- Sound 1,15,6,3,2
- Sound 1,15,6,4,2
- Sound 1,15,8,4,6
- Sound 1,0,0,0,0
- Return
- '
- Procedure Other_sound
- Sound 1,15,6,4,2
- Sound 1,15,1,4,5
- Sound 1,0,0,0,0
- Return
- '
- Procedure Finale_sound
- Restore Finale_data
- Read N%
- For I%=1 To N%
- Read Nt%,Oct%,Dur%
- Sound 1,15,Nt%,Oct%,Dur%
- Sound 1,0,0,0,0
- Pause 5
- Next I%
- Return
- '
- Procedure Erase_sound
- For Oct%=6 Downto 3
- For Nt%=12 Downto 1
- Sound 1,15,Nt%,Oct%,3
- Next Nt%
- Next Oct%
- Sound 1,0,0,0,0
- Return
- '
- Procedure Dud_sound
- For Oct%=4 Downto 1
- For Nt%=12 Downto 1
- Sound 1,15,Nt%,Oct%,2
- Next Nt%
- Next Oct%
- Sound 1,0,0,0,0
- Return
- '
- Procedure Alert_sound
- Sound 1,15,10,3,2
- Sound 1,0,0,0,0
- Return
- '
- ' ******************************* DATA *******************************
- Ms_data:
- Data 28672,18432,19456,29184,28928,14464,7488,3744,1872,904,452,230,121,57,31,14
- Data 0,12288,12288,3072,3584,1792,640,320,160,112,56,24,6,6,0,0
- '
- Brush_data:
- Data 0,26624,13312,23552,10240,0,768,384,192,96,48,24,12,6,0,0
- Data 63488,37888,51712,41472,55040,32640,7360,3680,1840,920,460,230,115,57,31,15
- '
- Finale_data:
- Data 7
- Data 6,4,16
- Data 1,4,8
- Data 1,4,8
- Data 3,4,16
- Data 1,4,32
- Data 5,4,16
- Data 6,4,64
- '
- Clor_choice_data:
- Data 0,1
- Data 27,0
- '
-